package com.itm.lqm.service;

import java.util.List;


import com.itm.lqm.dao.TeacherDao;
import com.itm.lqm.entity.Teacher;

public class TeacherService {
	
	TeacherDao td=new TeacherDao();
	//查询教师
			public List<Teacher> findAllTeacher(){
		List<Teacher> list=td.findAllTeacher();
		return list;
	}
			
			//根据tid查询教师
	public Teacher findTeacherByTid(int tid) {
		Teacher t=td.findTeacherByTid(tid);
		return t;
	}

	
		
		//添加教师
		public boolean addTeacher(Teacher tid){
			if(!td.isExistTid((tid.getTid()))){
				td.addTeacher(tid);
				return true;
			}else{
				System.out.println("此老师已存在");
				return false;
			}
			
		}
		
		
		//删除教师
			public boolean deleteTeacherTid(int tid){
				if(td.isExistTid(tid)){
					td.deleteTeacher(tid);
					return true;
				}else{
					return false;
				}
			}
			//修改教师
			public boolean  updateTeacher(Teacher s){
				if(td.isExistTid(s.getTid())){
					td.updateTeacher(s);
					return true;
				}else{
					return false;
				}
			}
			

}
